package kr.hkit.powerjava.chapter07;

public class StringTest {
	public static void main(String[] args) {
		String str1 = "Hello Java";
		String str2 = "MySQL";
		String str3 = "mysql";
		
		try{
			char ch = str1.charAt(8);
			System.out.println(ch);
			
			System.out.println(str1.compareTo(str2)==0?"같음":str1.compareTo(str2));
			
			System.out.println(str1.concat(str2));
			
			System.out.println(str1.equals(str2)?"같음":"다름");
			System.out.println(str1.equals("Hello Java")?"같음":"다름");
			
			System.out.println(str2.equals(str3)?"같음":"다름");
			System.out.println(str2.equalsIgnoreCase(str3)?"같음":"다름");
			
			System.out.println(str1.isEmpty());
			System.out.println("".isEmpty());
			
			System.out.println(str1.length());
			
			for(int i = 0; i < str1.length(); i++){
				System.out.println(str1.charAt(i));
			}
			
			System.out.println(str1.replace('l', 'L'));
			
			System.out.println(str1.substring(6, 8));
			
			System.out.println("대문자 변환" + str1.toUpperCase());
			System.out.println("소문자 변환" + str1.toLowerCase());
			
			
		}catch(IndexOutOfBoundsException e){
		System.out.println("인덱스는 0 ~ "+ str1.length() + "까지 가능");
		}
	}
}
